﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Xml;
using System.Data;
using System.Configuration;

using Gift.DAL;
using Gift.Model;
using Gift.WebApp;


public partial class cn_UserControl_group_buy_header : System.Web.UI.UserControl
{
    // Fields
    protected string basicSetXmlPath = "/cn/xml/website_set.xml";
    BasePage thePage = new BasePage();
    // Methods
    protected StringBuilder GroupBuyCategoryBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            builder.AppendLine("<div class=\"search\"><p>");
            int groupBuyBylanguageVersionAndIsShelves = BaseFactory.theGroupBuy.GetGroupBuyBylanguageVersionAndIsShelves("zh-CN", 1);
            DataTable table = BaseFactory.theGroupBuyCategory.GetGroupBuyCategoryByTopAndIsShowAndLanguageAndIsShelves(10, 1, "zh-CN", 1);
            builder.AppendLine("<a href=\"/cn/group_buy_list.html\">全部(" + groupBuyBylanguageVersionAndIsShelves + ")</a>");
            foreach (DataRow row in table.Rows)
            {
                builder.AppendLine(string.Concat(new object[] { "<a href=\"/cn/group_buy_list.html?cid=", row["id"], "\">", row["categoryName"], "(", row["count"], ")</a>" }));
            }
            builder.AppendLine("</p></div>");
        }
        catch
        {
        }
        return builder;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected StringBuilder UserBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            string attribute = "";
            XmlDocument document = new XmlDocument();
            document.Load(base.Server.MapPath(this.basicSetXmlPath));
            attribute = ((XmlElement)document.SelectSingleNode("set/cn_enterprise_sort_name")).GetAttribute("value");
            builder.AppendLine("<div class=\"wel\">");
            builder.AppendLine("<div class=\"width1000\">");
            builder.AppendLine("<p class=\"top_function\">");
            builder.AppendLine("<a href=\"/cn/member_center/my_group_buy_order.html\" class=\"order\">团购订单</a><a href=\"/cn/help_center/help_list.html\" class=\"help\">帮助中心</a><a href=\"/cn/news_center/news_list.html\" class=\"into\">资讯中心</a><a href=\"/cn/recruitment/recruitment_list.html\" class=\"human\">人才招聘</a><a href=\"/cn/online_message.html\" class=\"omessage\">在线留言</a>");
            builder.AppendLine("<p id=\"puser\">");
            if (base.Session["user"] != null)
            {
                int inBoxNoIsReadByAddressee = BaseFactory.theInBox.GetInBoxNoIsReadByAddressee(thePage.LoginUserMember.ClientUser.userName);
                builder.AppendLine(string.Concat(new object[] { "您好，<span class=\"red\">", thePage.LoginUserMember.ClientUser.userName, "</span>，欢迎光临 <strong>", attribute, "</strong>！&nbsp;<a href=\"/cn/member_center/my_order.html\">[&nbsp;会员中心&nbsp;]</a>&nbsp;<a class=\"mail\" href=\"/cn/member_center/in_box.html\">(<strong>", inBoxNoIsReadByAddressee, "</strong>)</a>&nbsp;<a href=\"userExitHandler.ashx\">[&nbsp;退出&nbsp;]</a>" }));
            }
            else
            {
                builder.AppendLine("您好，欢迎光临 <strong>" + attribute + "</strong>！&nbsp;<a href=\"/cn/login.html?TB_iframe=true&height=370&width=640\" class=\"thickbox\">[<span class=\"red\">登录</span></a> /&nbsp;<a href=\"/cn/register.html?TB_iframe=true&height=370&width=640\" class=\"thickbox\">注册]</a>");
            }
            builder.AppendLine("<p>");
            builder.AppendLine("</div>");
            builder.AppendLine("</div>");
        }
        catch
        {
        }
        return builder;
    }

}